//
//  XZMessageCenterViewController.m
//  IBeeBo
//
//  Created by Sean on 16/4/4.
//  Copyright © 2016年 Sean. All rights reserved.
//

#import "XZMessageCenterViewController.h"
#import "XZTestViewController.h"


@interface XZMessageCenterViewController ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation XZMessageCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"写私信" style:UIBarButtonItemStylePlain target:self action:@selector(composeMessage)];

       XZLog(@"消息模块创建一次");
}
- (void)composeMessage{
    
    XZLog(@"composeMessage");
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    //itme不能点
    self.navigationItem.rightBarButtonItem.enabled = NO;

}


#pragma mark--UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 20;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *CellID = @"MessageCenter";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
    }
    
    cell.textLabel.text = [NSString stringWithFormat:@"MessageCenter%ld",indexPath.row];
    
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    XZTestViewController *test = [[XZTestViewController alloc] init];
    test.title = @"测试1";
    //当test控制器push的时候, test所在的TabBarController的tabbar会自动隐藏
    test.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:test animated:YES];
    
    
}
@end
